/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
struct ListNode* removeElements(struct ListNode* head, int val){
    struct ListNode*cur=(struct ListNode*)malloc(sizeof(struct ListNode));
    cur->next=head;
    struct ListNode*temp=cur;
    while(NULL!=(temp->next))
    {
        if(val==temp->next->val)
        {
            temp->next=temp->next->next;
        }else
        {
            temp=temp->next;
        }
    }
    return cur->next;
}





